package com.molin.DateTest.jdk8DateTest;

import java.time.Duration;
import java.time.LocalDateTime;

public class Demo8 {
    public static void main(String[] args) {
        LocalDateTime start = LocalDateTime.of(2020, 1, 1, 13, 14, 1);
        LocalDateTime end = LocalDateTime.of(2020, 1, 1, 15, 17, 1);
        Duration duration = Duration.between(start
                , end);
        System.out.println(duration);
        System.out.println(duration.toSeconds());
        System.out.println(duration.toMillis());
        System.out.println(duration.toNanos());
        System.out.println(duration.toMinutes());
    }
}
